
<!DOCTYPE html>
<html class="no-js">
<head lang="en">

    <#include "../head_import.html" />

</head>
<body>
<#include "../include/top_nav.html">
    <div class="am-cf admin-main">

        <!-- sidebar start -->
        <#include "../order/left.html">
            <!-- sidebar end -->
            <!-- content start-->
            <div class="admin-content">
                <div class="am-cf am-padding">
                    <div class="am-fl am-cf"><@s.m "global.position"/>:  <@s.m "order.function"/> - 查看</div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-sm-centered">
                        <form class="ropt">
                            <input type="button" value="<@s.m "global.backToList"/>" onclick="history.back();"/>
                        </form>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-sm-centered">
                        <form id="baseForm" method="post" class="am-form">
                            <input type="hidden" name="id" value="${order.id}"/>
                            <input type="submit" value="确认" onclick="this.form.action='o_affirm.do'" <#if order.status!=1>disabled</#if>/>
                            <input type="submit" value="支付" onclick="this.form.action='payment.do'" <#if order.paymentStatus!=1>disabled <#elseif order.payment.type==1>disabled</#if>/>
                            <input type="submit" value="发货" onclick="this.form.action='shipments.do'" <#if order.shippingStatus!=1>disabled<#elseif order.status!=2>disabled<#elseif order.payment.type==1><#if order.paymentStatus!=2>disabled</#if></#if>/>
                            <input type="submit" value="完成" onclick="this.form.action='o_accomplish.do'" <#if order.shippingStatus!=2>disabled<#elseif order.paymentStatus!=2>disabled<#elseif order.status!=2>disabled</#if>/>
                            <input type="submit" value="取消"  onclick="this.form.action='o_abolish.do'" <#if order.status=3>disabled<#elseif order.shippingStatus=2>disabled<#elseif order.paymentStatus=2>disabled<#elseif order.status=4>disabled</#if>/>
                        </form>
                        <@p.form id="baseForm" action="o_update.do" labelWidth="12">
                        <@p.td colspan="2"><strong class="title"><@s.m "order.product"/></strong></@p.td><@p.tr/>
                    <@p.td colspan="2">
                    <@p.table value=order.items;item,i,has_next><#rt/>
                    <@p.column code="product.code" style="width:100px"><#if item.product.productExt??>${item.product.productExt.code!}</#if></@p.column><#t/>
                <@p.column code="product.name" align="left"><img src="${item.product.productExt.coverImg!}" width="50" height="50"/>
                ${item.product.name!}&nbsp;<#if item.productFash??>${item.productFash.attitude!}</#if></@p.column><#t/>
                            <@p.column code="orderItem.finalPrice" style="width:110px">${item.salePrice!}</@p.column><#t/>
                        <@p.column code="单重" style="width:60px"><span id="itemWeight_${item.id}">${item.product.weight}</span></@p.column><#t/>
                    <@p.column code="orderItem.count" style="width:60px">${item.count}</@p.column><#t/>
                <@p.column code="orderItem.subtotal" style="width:100px"><span id="subtotal_${item.id}"><#if item.productFash??>${item.productFash.salePrice*item.count!0}
                    <#else>${item.product.salePrice*item.count!0}</#if></span>
                </@p.column><#t/>
                </@p.table>
                </@p.td><@p.tr/>

                <@p.td colspan="2"><strong class="title"><@s.m "order.info"/></strong></@p.td><@p.tr/>
                <@p.td colspan="1" width="50" label="订单编号">${order.code}</@p.td>
                <@p.td colspan="1" width="50" label="order.createTime">${order.createTime}</@p.td><@p.tr/>

                <@p.td colspan="1" width="50" label="order.status">
                <@s.m "order.status.${order.status}"/>
                </@p.td>
                <@p.td colspan="1" width="50" label="order.paymentStatus">
                <@s.m "order.paymentStatus.${order.paymentStatus}"/>
                </@p.td>
                <@p.tr/>
                <@p.td colspan="1" width="50" label="order.shippingStatus">
                <@s.m "order.shippingStatus.${order.shippingStatus}"/>
                </@p.td>
                <@p.td colspan="1" width="50" label="order.createTime">${order.shipping.name}</@p.td><@p.tr/>
                <@p.td colspan="1" width="50" label="order.productPrice"><span id="productPrice">${order.productPrice}</span></@p.td>
                <@p.td colspan="1" width="50" label="order.freight" required="true">${order.freight}</@p.td><@p.tr/>
                <@p.td colspan="1" width="50" label="order.total"><span id="total">${order.total!0}</span>
                <input type="hidden" id="totalPrice" name="totalPrice" value="${order.total!0}"/></@p.td>
                <@p.td colspan="1" width="50" label="order.payment"><#if order.payment??>${order.payment.name}</#if></@p.td><@p.tr/>

                <@p.td colspan="2"><strong class="title">收货人信息</strong></@p.td><@p.tr/>
                <@p.td colspan="1" width="50" label="收货人姓名">${order.receiveName!}</@p.td>
                <@p.td colspan="1" width="50" label="收货人电话">${order.receiveMobile!}</@p.td><@p.tr/>
                <@p.td colspan="1" width="50" label="收货人固定电话">${order.receivePhone!}</@p.td>
                <@p.td colspan="1" width="50" label="收货人邮编">${order.receiveZip!}</@p.td><@p.tr/>
                <@p.td colspan="2" label="收货人地址">${order.receiveAddress!}</@p.td><@p.tr/>
                <@p.td colspan="2" label="order.comments">${order.comments!}</@p.td><@p.tr/>
                </@p.form>
            </div>
    </div>



    </div>

    </div>
</body>
</html>









<script type="text/javascript">
    function changeCount(){
        var totalWeight=0.0;
        $("#[id^='itemCount_']").each(function(){
            var ss=parseFloat(jQuery(this).val());
            var h=jQuery(this).attr("id");
            var index=h.split("_")[1];
            var weight=$("#itemWeight_"+index).html();
            totalWeight+=ss*weight;
        });
        ajaxtotalDeliveryFee($("#shippingId").val(),totalWeight);
        setTimeout(function(){changePrice()},1000);
    }

    function changePrice(){
        var totalPrice=0.0;
        $("#[id^='itemPrice_']").each(function(){
            var ss=parseFloat(jQuery(this).val());
            var h=jQuery(this).attr("id");
            var index=h.split("_")[1];
            var count=$("#itemCount_"+index).val();
            $("#subtotal_"+index).html("");
            $("#subtotal_"+index).html(count*ss);
            totalPrice+=count*ss;
        });
        $("#productPrice").html("");
        $("#productPrice").html(totalPrice);
        $("#total").html("");
        $("#total").html(parseFloat($("#freight").val())+totalPrice);
        $("#totalPice").val(parseFloat($("#freight").val())+totalPrice);
    }

    function changeFreight(){
        var ss=parseFloat($("#productPrice").html());
        $("#total").html("");
        ss+=parseFloat($("#freight").val());
        $("#total").html(ss);
    }

    function ajaxtotalDeliveryFee(d,w){
        $.post("../order/ajaxtotalDeliveryFee.do", {
            'deliveryMethod':d,
            'weight':w
        }, function(data) {
            if(data.status==1){
                $("#freight").val(data.freight);
                return data.freight;
            }
        },'json');
    }

    function statusChange(status){
        if(status==19){
            $("#baseForm").attr("action","o_returnMoney.do");
        }
        $("#status").val(status);
    }
</script>